//
//  CMSChartsContentModel.m
//  CMSCharts
//
//  Created by symbio on 2023/2/17.
//

#import "CMSChartsContentModel.h"
#import "NSObject+YYModel.h"

@interface CMSChartsContentModel ()

@property (nonatomic, copy) NSDictionary *timeChartDict;
@end

@implementation CMSChartsContentModel

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.tagTitles = @[@"上证指数", @"不复权", @"BIAS"];
        self.attributedString = [[NSMutableAttributedString alloc] initWithString:@"123456789123456789123456789123456789123456" attributes:@{NSForegroundColorAttributeName:[UIColor blackColor], NSFontAttributeName:[UIFont systemFontOfSize:10]}];
        
        self.timeChartDict = @{
            @"CMSChartsTypeTimeHK" : @[
                @{
                    @"name" : @"9:30",
                    @"isShowLine" : @false,
                    @"isShowLabel" : @true,
                    @"labelAlignment" : @1,
                    @"xPosition" : @0
                },
                @{
                    @"name" : @"",
                    @"isShowLine" : @true,
                    @"isShowLabel" : @false,
                    @"xPosition" : @80
                },
                @{
                    @"name" : @"12:00",
                    @"isShowLine" : @true,
                    @"isShowLabel" : @true,
                    @"xPosition" : @150
                },
                @{
                    @"name" : @"",
                    @"isShowLine" : @true,
                    @"isShowLabel" : @false,
                    @"xPosition" : @240
                },
                @{
                    @"name" : @"16:00",
                    @"isShowLine" : @false,
                    @"isShowLabel" : @true,
                    @"labelAlignment" : @2,
                    @"xPosition" : @330
                }
            ],
            @"CMSChartsTypeTimeSharing" : @[
                @{
                    @"name" : @"9:30",
                    @"isShowLine" : @false,
                    @"isShowLabel" : @true,
                    @"labelAlignment" : @1,
                    @"xPosition" : @0
                },
                @{
                    @"name" : @"",
                    @"isShowLine" : @true,
                    @"isShowLabel" : @false,
                    @"xPosition" : @60
                },
                @{
                    @"name" : @"11:30",
                    @"isShowLine" : @true,
                    @"isShowLabel" : @true,
                    @"xPosition" : @120
                },
                @{
                    @"name" : @"",
                    @"isShowLine" : @true,
                    @"isShowLabel" : @false,
                    @"xPosition" : @180
                },
                @{
                    @"name" : @"15:00",
                    @"isShowLine" : @false,
                    @"isShowLabel" : @true,
                    @"labelAlignment" : @2,
                    @"xPosition" : @240
                }
            ],
            @"CMSChartsTypeTimeSummerUS" : @[
                @{
                    @"name" : @"9:30",
                    @"isShowLine" : @false,
                    @"isShowLabel" : @true,
                    @"labelAlignment" : @1,
                    @"xPosition" : @0
                },
                @{
                    @"name" : @"",
                    @"isShowLine" : @true,
                    @"isShowLabel" : @false,
                    @"xPosition" : @96
                },
                @{
                    @"name" : @"",
                    @"isShowLine" : @true,
                    @"isShowLabel" : @false,
                    @"xPosition" : @291
                },
                @{
                    @"name" : @"16:00",
                    @"isShowLine" : @false,
                    @"isShowLabel" : @true,
                    @"labelAlignment" : @2,
                    @"xPosition" : @390
                }
            ],
            @"CMSChartsTypeTimeWinterUS" : @[
                @{
                    @"name" : @"9:30",
                    @"isShowLine" : @false,
                    @"isShowLabel" : @true,
                    @"labelAlignment" : @1,
                    @"xPosition" : @0
                },
                @{
                    @"name" : @"",
                    @"isShowLine" : @true,
                    @"isShowLabel" : @false,
                    @"xPosition" : @96
                },
                @{
                    @"name" : @"",
                    @"isShowLine" : @true,
                    @"isShowLabel" : @false,
                    @"xPosition" : @291
                },
                @{
                    @"name" : @"16:00",
                    @"isShowLine" : @false,
                    @"isShowLabel" : @true,
                    @"labelAlignment" : @2,
                    @"xPosition" : @390
                }
            ],
            @"CMSChartsTypeTimeEU" : @[]
        };
    }
    return self;
}

- (double)backAmoutCountOfChart:(CMSChartsType)chartType {
    
    switch (chartType) {
        case CMSChartsTypeTimeHK:
            return CMSCountHK;
        case CMSChartsTypeTimeSummerUS:
            return CMSCountSummerUS;
        case CMSChartsTypeTimeWinterUS:
            return CMSCountWinterUS;
        case CMSChartsTypeTimeEU:
            return CMSCountEU;
        default:
            return CMSCountCN;
    }
    
}

- (NSArray<CMSChartsXPositionModel *> *)backXPositionInfoForType:(CMSChartsType)chartType {
    NSMutableArray *itemsArray = [NSMutableArray array];
    switch (chartType) {
        case CMSChartsTypeTimeHK:
            itemsArray = self.timeChartDict[@"CMSChartsTypeTimeHK"];
            break;
        case CMSChartsTypeTimeSummerUS:
            itemsArray = self.timeChartDict[@"CMSChartsTypeTimeSummerUS"];
            break;
        case CMSChartsTypeTimeWinterUS:
            itemsArray = self.timeChartDict[@"CMSChartsTypeTimeWinterUS"];
            break;
        case CMSChartsTypeTimeSharing:
            itemsArray = self.timeChartDict[@"CMSChartsTypeTimeSharing"];
            break;
        case CMSChartsTypeTimeEU:
            itemsArray = self.timeChartDict[@"CMSChartsTypeTimeEU"];
            break;
        default:
            break;
    }
    NSMutableArray *result = [NSMutableArray array];
    for (NSDictionary *item in itemsArray) {
        CMSChartsXPositionModel *model = [CMSChartsXPositionModel modelWithDictionary:item];
        [result addObject:model];
    }
    return result;
}


@end

@implementation CMSChartsXPositionModel
@end
